Navigation

Comments

Comments compensate for failing to express intent Comments are undesirable can deviate and mislead without generating bugs in performance like code does

Comments Do Not Make Up For Bad Code

Better to rewrite than to comment bad code

Explain Yourself In Code

Better to write a function named what the comment would be

Good Comments

Bad Comments

Don’t Use a Comment When You Can Use A Function

variable names provide documentation

Position Markers

easily become background noise

Closing Brace Comments

better to abstract / shorten blocks by creating separate functions

Attributions and Bylines

duplicates source control

Commented-Out Code

source control can remember deleted code for you

HTML Comments

messy

Nonlocal Information

comments should be co-located with what they’re describing to preserve likelihood of upkeep during change

Too Much Information

extraneous information that could be externally linked

Inobvious Connection

comments which don’t clearly connect to the code they’re annotating

Function Headers

better to improve function name / definition

Javadocs in Nonpublic Code

just clutter; devs can read the code if they have to